package com.zzh.jetpackdemo.room.dao

import androidx.room.*
import com.zzh.jetpackdemo.room.data.User

/**
 * @author zhangzhihao
 * @email zhangzhihao@gongjiangren.net
 * @date 2020-08-19
 * @desc
 */
@Dao
interface UserDao {

    @Insert
    fun insert(user: User): Long


    @Insert
    fun insertAll(vararg user: User)


    @Delete
    fun delete(user: User)

    @Delete
    fun deletaAll(vararg user: User)


    @Update
    fun update(user: User)


    @Query(value = "select * from user")
    fun loadUsers(): List<User>


    @Query(value = "select * from user where id =:id")
    fun loadUser(id: Long): User

}